/*    */ package com.zimbra.cs.service.account;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AccountConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.cs.account.Account;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class GetWhiteBlackList
/*    */   extends AccountDocumentHandler
/*    */ {
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 33 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 34 */     Account account = getRequestedAccount(zsc);
/*    */     
/* 36 */     if (!canAccessAccount(zsc, account)) {
/* 37 */       throw ServiceException.PERM_DENIED("can not access account");
/*    */     }
/* 39 */     String[] senders = account.getMultiAttr("amavisWhitelistSender");
/*    */     
/* 41 */     Element response = zsc.createElement(AccountConstants.GET_WHITE_BLACK_LIST_RESPONSE);
/*    */     
/*    */ 
/* 44 */     senders = account.getMultiAttr("amavisWhitelistSender");
/* 45 */     doList(response, "whiteList", senders);
/*    */     
/*    */ 
/* 48 */     senders = account.getMultiAttr("amavisBlacklistSender");
/* 49 */     doList(response, "blackList", senders);
/*    */     
/* 51 */     return response;
/*    */   }
/*    */   
/*    */   private void doList(Element response, String list, String[] senders) {
/* 55 */     Element eList = response.addElement(list);
/*    */     
/* 57 */     for (String sender : senders) {
/* 58 */       eList.addElement("addr").setText(sender);
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/account/GetWhiteBlackList.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */